package com.qcby.controller;

import com.qcby.entity.Test;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @author heaboy
 */
@Controller
@RequestMapping("test")
public class TestController {
    @RequestMapping("index")
    public String index(HttpServletRequest request, HttpServletResponse response, Model model){
        request.setAttribute("msg","this is not  a hello world");
        return "test1";
    }
    @RequestMapping("index1")
    public String index1( Model model){
       model.addAttribute("msg"," This is  a Test!");
        return "test1";
    }
    @RequestMapping("index2")
    public String index2(Model model, @RequestParam("account") String account,@RequestParam("pwd") String pwd){
        System.out.println(account);
        System.out.println(pwd);
        model.addAttribute("msg"," This is  a Test!");
        model.addAttribute("account",account);
        model.addAttribute("pwd",pwd);
        return "test1";
    }
    @RequestMapping("index3")
    public String index3(Model model,  String account,String pwd){
        System.out.println(account);
        System.out.println(pwd);
        model.addAttribute("msg"," This is  a Test!");
        model.addAttribute("account",account);
        model.addAttribute("pwd",pwd);
        return "test1";
    }

}
